<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>学生列表</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet">
    <style>
        body {
            padding: 20px;
        }

        table {
            width: 100%;
        }

        table th, table td {
            vertical-align: middle;
        }

        .btn {
            margin: 5px;
        }
    </style>
</head>
<body>

<div class="container">
    <h1 class="mb-4">学生列表</h1>
    <a href="#" class="btn btn-primary mb-3" th:href="@{/student/create}">新增学生</a>

    <table class="table table-striped table-bordered">
        <thead class="table-dark">
        <tr>
            <th>姓名</th>
            <th>性别</th>
            <th>班级</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <tr th:each="student : ${students}">
            <td th:text="${student.name}"></td>
            <td th:text="${student.gender}"></td>
            <td th:text="${student.className}"></td>
            <td>
                <a href="#" th:href="@{/student/edit/{id}(id=${student.id})}" class="btn btn-warning">编辑</a>
                <a href="#" th:href="@{/student/delete/{id}(id=${student.id})}" class="btn btn-danger">删除</a>
            </td>
        </tr>
        </tbody>
    </table>
</div>

<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
